<template>
	<view class="gjl-components">
		<view class="search-box">
			<view class="search-title">
				热门搜索
			</view>
			<view class="search-list">
				<view class="search-item" v-for="(item,index) in hotList" :key="index">
					<view class="btn" @click="btnClick(item,1)">
						<u-icon name="xin" custom-prefix="custom-icon" color="#333333" size="24"></u-icon>
						<view class="text">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="search-box" v-if="historyList.length">
			<view class="search-title">
				历史记录
			</view>
			<view class="search-list">
				<view class="search-item" v-for="(item,index) in historyList" :key="index">
					<view class="btn" @click="btnClick(item,2)">
						<u-icon name="xin" custom-prefix="custom-icon" color="#333333" size="24"></u-icon>
						<view class="text">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			hotList: {
				type: [Array],
				default: function (){
					return [{
						name: '----烧烤串串',
						id: 0
					},
					{
						name: '----甜品饮品',
						id: 1
					},
					{
						name: '----家常中餐',
						id: 2
					},
					{
						name: '----西餐',
						id: 3
					},
					{
						name: '----烤肉',
						id: 4
					},
					{
						name: '----日本料理',
						id: 5
					}]
				}
			},
			historyList: {
				type: [Array],
				default: function (){
					return []
				}
			}
		},
		data(){
			return {
				
			}
		},
		methods: {
			btnClick(item,index){
				this.$emit('btnClick', item, index)
			}
		}
	}
</script>

<style scoped lang="scss">
	.gjl-components{
		.search-box + .search-box{
			margin-top: 80rpx;
		}
		.search-box{
			.search-title{
				font-size: 28rpx;
				font-weight: 400;
				color: #000000;
			}
			.search-list{
				margin-top: 30rpx;
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				.search-item{
					margin-right: 20rpx;
					margin-bottom: 20rpx;
					.btn{
						display: flex;
						align-items: center;
						justify-content: center;
						height: 54rpx;
						padding: 0 20rpx;
						background: #EFEFEF;
						border-radius: 27px;
						.text{
							margin-left: 8rpx;
							font-size: 24rpx;
							font-weight: 400;
							color: #333333;
						}
					}
				}
			}
		}
	}
</style>